﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace Max.PH5_2103A.Shopping.TEntityFrame.Domain
{
    /// <summary>
    /// SKU信息
    /// </summary>
    [Table("tb_product_sku")]
    public class SKUEntity : AuditField
    {
        public Guid Id { get; set; }

        #region 基本信息：名称、类别、品牌、采购日期、状态、销量
        public string Name { get; set; }  //名称
        public Guid? CategoryId { get; set; }  //分类id
        public Guid? BrandId { get; set; } //品牌id
        public DateTime? ProcureDate { get; set; } = System.DateTime.Now; //采购时间
        public string? ProcureBy { get; set; } //采购人
        public string State { get; set; } = "0";//0=上架、1=下架
        public int SaleNumber { get; set; } // 销量 100  
        public string? Description { get; set; }

        #endregion

        #region 库存信息

        public int Stock { get; set; } //总库存  300
        public int EnableStock { get; set; }    //可用库存  200
        public int LockStock { get; set; }  //锁定库存   0

        #endregion

        #region 价格信息

        [Column(TypeName ="decimal(18,2)")]
        public decimal InPrice { get; set; }    //进货价格

        [Column(TypeName = "decimal(18,2)")]
        public decimal SalePrice { get; set; }  //销售价格

        [Column(TypeName = "decimal(18,2)")]
        public decimal MarketPrice { get; set; } //市场价格

        #endregion

        //2023/8/24 标记字段
        /*
         * 第1位：表示推荐
         * 第2位：表示特价
         * 第3位：表示新品
         * 第4位。。。。预留
         * 
         * **/
        public string Flag { get; set; } = "00000000";

        /// <summary>
        /// 共享锁---时间戳
        /// </summary>
        [Timestamp]
        public byte[] TimeStamp { get; set; }

    }

    /// <summary>
    /// SKU对应的图片表
    /// </summary>
    [Table("tb_product_sku_image")]
    public class SKUImageModel
    {
        public Guid Id { get; set; }
        public Guid SKUId { get; set; }
        public string ImagePath { get; set; } //图片路径
        public string? ImageSort { get; set; } //图卡排序
    }
}
